package cn.itcast.controller;

import cn.itcast.dataobject.Member;
import cn.itcast.service.MemberService;
import cn.itcast.utils.ResultVOUtil;
import cn.itcast.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: wangxg
 * @date: 2019-06-22 05:13
 **/

@RestController
@Api(description = "前端学员管理")
@RequestMapping("/api/ucenter/member")
public class MemberController {

    @Autowired
    private MemberService memberService;

    @ApiOperation(value = "注册学员", notes = "updateTime,createTime无需添加，这是前台系统用户的注册功能，前提是用户已经接收了验证码")
    @PostMapping
    public ResultVO register(
            //定义请求参数的文档描述 name的值是要描述的参数的名字
            @ApiParam(name = "member", value = "学员对象", required = true)
            @RequestBody Member member) {
        memberService.save(member);
        return ResultVOUtil.success();
    }
}
